home *** CD-ROM | disk | FTP | other *** search
/ FM Towns: Free Software Collection 7 / FM Towns Free Software Collection 7.iso / taropyon / guilib3 / prg / dll / bgm / bgmtst.c < prev    next >
C/C++ Source or Header  |  1993-11-30  |  2KB  |  125 lines

  1. /*************************************************************************
  2. *    BGM.DLL テストプログラム
  3. *************************************************************************/
  4.  
  5. #include    <stdio.h>
  6. #include    <stdlib.h>
  7. #include    <string.h>
  8.  
  9. #include    <egb.h>
  10. #include    <snd.h>
  11. #include    <sidework.h>
  12. #include    <xld.h>
  13.  
  14. #include    <setint.h>
  15. #include    <disp.h>
  16. #include    <dialog.h>
  17. #include    <fslib.h>
  18. #include    <mouse.h>
  19. #include    <fdl.h>
  20.  
  21. #include    "midi.h"
  22.  
  23. static    PLT_RGB    PltDat[16] =
  24. {
  25.     /* G R  B                                */
  26.     { 0, 0, 0},    /* C_BALCK                    */
  27.     { 0, 0, 0},    /* C_BLUE or C_THROUGH        */
  28.     { 7, 7, 8},    /* C_RED                    */
  29.     {12,12,13},    /* C_MAGENTA                */
  30.     { 6, 5, 7},    /* C_GREEN                    */
  31.     { 8, 7, 9},    /* C_CYAN                    */
  32.     {10, 9,11},    /* C_YELLOW                    */
  33.     {11,11,12},    /* C_WHITE                    */
  34.  
  35.     { 5, 5, 6},    /* C_HBALCK                    */
  36.     { 0, 0,11},    /* C_HBLUE                    */
  37.     { 0,11, 0},    /* C_HRED                    */
  38.     { 0,11,11},    /* C_HMAGENTA                */
  39.     {11, 0, 0},    /* C_HGEEN                    */
  40.     {11, 0,11},    /* C_HCYAN                    */
  41.     {11,11, 0},    /* C_HYELLOW                */
  42.     {14,14,15}    /* C_HWHITE                    */
  43. };
  44.  
  45. void    main(int argc, char **argv)
  46. {
  47.     int        i;
  48.  
  49.     set_ctrl_c();
  50.     set24h();
  51.  
  52.     if ( SndPtr == NULL )
  53.     {
  54.         if ( (SndPtr = calloc(16384,1)) == NULL )
  55.             return;
  56.         SND_init( SndPtr );
  57.     }
  58.  
  59.     DSP_sysInit(NULL);
  60.     DSP_set_defFnt( FNTYPE_USR1 );
  61.     GetFnt12Ptr(0);
  62.     for ( i = 0; i < 2; ++i )
  63.     {
  64.         DSP_writePage(i);
  65.         DSP_setPlt(PltDat);
  66.     }
  67.     KBF_sysInit();
  68.     FDL_sysInit();
  69.     sdk_control(0);
  70.  
  71.     _XLD_init(NULL);
  72.     _XLD_setMemFunc( malloc, free );
  73.     {
  74.         char    tmp[256];
  75.         int        len;
  76.         FS_setStartPath( tmp, argv[0] );
  77.         if ( (len = strlen(tmp)) > 0 )
  78.             tmp[--len] = '\0';
  79.         _XLD_setLinkPath( tmp );
  80.     }
  81.     _XLD_lockLib( MID_playStatFlag );
  82.  
  83.     MID_sysInit();
  84.  
  85.     /* ファイルダイアログで使うワイルドカード    */
  86.     FdlSetWildCardList( "*.[me][iu][dp]" );
  87.     FdlSetWildCardList( "*.mid" );
  88.     FdlSetWildCardList( "*.eup" );
  89.  
  90.     DSP_writePage(1);
  91.     FDL_T    *fdl = NULL;
  92.     if ( (fdl = FDL_open(FDL_MODE_DEFAULT)) == NULL )
  93.         goto _RET;
  94.     FDL_set_title( fdl, "BGM PLAY");
  95.  
  96.     LOOP
  97.     {
  98.         int        ret;
  99.         char    *fn;
  100.  
  101.         FDL_set_wildcard( fdl, "*.[me][iu][dp]");    /* デフォルトワイルドカード    */
  102.         ret = FDL_start(fdl);
  103.         fn = FDL_get_filename(fdl);
  104.         if ( ret != NORMAL || strlen(fn) == 0 )
  105.             break;
  106.         {
  107.             MID_playStart(fn);
  108.         }
  109.     }
  110.  
  111. _RET:
  112.     MID_sysEnd();
  113.     FDL_sysEnd();
  114.     KBF_sysEnd();
  115.     DSP_sysEnd();
  116.  
  117.     if ( SndPtr )
  118.     {    SND_end();
  119.         free(SndPtr);
  120.         SndPtr = NULL;
  121.     }
  122.  
  123.     reset24h();
  124. }
  125.